//
//  ViewController.m
//  之定义下载进度条2
//
//  Created by Jorn.Wu on 15/6/28.
//  Copyright (c) 2015年 Jorn.Wu. All rights reserved.
//

#import "ViewController.h"
#import "ProgressView.h"

@interface ViewController ()

@property (nonatomic, strong) ProgressView *pv;
@property (nonatomic, strong) NSTimer *time;
@property (nonatomic, assign) CGFloat p;

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    self.p = 0;
    _pv = [[ProgressView alloc]initWithFrame:CGRectMake(0, 0, 250, 250)];
    _pv.backgroundColor = [UIColor grayColor];
    _pv.center = self.view.center;
//    _pv.progress = self.p / 360;
    [self.view addSubview:_pv];
    
    _time = [NSTimer scheduledTimerWithTimeInterval:0.25 target:self selector:@selector(timeAction:) userInfo:nil repeats:YES];
}
- (void)timeAction:(NSTimer *)timer{
    if (self.p >= 360) {
        self.p = 0;
    }else{
        self.p++;
    }
    _pv.progress = self.p / 360;

    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
